<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Home</title>
<link href="assets/css/lib/themify-icons.css" rel="stylesheet">
<link href="assets/css/lib/menubar/sidebar.css" rel="stylesheet">
<link href="assets/css/lib/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/style.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet" />
<script src="js/jquery.min.js"></script>
<script src="js/layer-v3.1.1/layer/layer.js"></script>
<script src="js/demo.js"></script>
<script type="text/javascript" src="js/pagination.js"></script>
</head>
<%
	String key = request.getParameter("keywords");
%>
<style>
#loginBox2 {
	display: none;
}

.black_overlay {
	display: none;
	position: absolute;
	top: 0%;
	left: 0%;
	width: 100%;
	height: 100%;
	background-color: white;
	z-index: 1001;
	-moz-opacity: 0.8;
	opacity: .30;
	filter: alpha(opacity = 88);
}

.white_content {
	display: none;
	position: absolute;
	top: 25%;
	left: 25%;
	width: 55%;
	height: 90%;
	padding: 20px;
	border: 5px solid aliceblue;
	background-color: white;
	z-index: 1002;
	overflow: auto;
}
</style>
<script type="text/javascript" src="../js/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
	window.onload = function() {
		xmlhttp = new XMLHttpRequest();
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) {
				if (xmlhttp.status == 200) {
					var respTxt = xmlhttp.responseText;
					window.eval("var arr=" + respTxt);
					var html = '<div class="card-body"><div class="table-responsive">';
					html += '<table class="table student-data-table m-t-20"><thead>';
					html += '<tr><th>id</th><th>user_id</th><th>order_time</th><th>order_price</th><th>state</th><th>edit</th><th>delete</th><th>send</th></tr>';
					for (var i = 0; i < arr.length; i++) {
						html += '<tbody id="tablelsw"><tr><td>'
								+ arr[i].order_id + '</td>';
						html += '<td>' + arr[i].user_id + '</td>';
						html += '<td>' + arr[i].order_time + '</td>';
						html += '<td>' + arr[i].order_price + '</td>';
						if(arr[i].state==false){
							html += '<td> 未发货 </td>';
						}
						else{
							html += '<td> 已发货 </td>';
						}
						html += '<td>'+'<a href="javascript:void(0)" onclick="document.getElementById(\'light\').style.display=\'block\';document.getElementById(\'fade\').style.display=\'block\'">查看详情</a>';
						html += '<div id="light" class="white_content"><table width="500px" align="center"><thead><tr><th>id</th><th>title</th><th>num</th><th>price</th></tr></thead><tbody>';
						for (var j = 0; j < arr[i].orderDetails.length; j++) {
							var id=j+1;
							html += '<tr><td>' + id + '</td>';
							html += '<td>'
									+ arr[i].orderDetails[j].bookDetails.title
									+ '</td>'
							html += '<td>' + arr[i].orderDetails[j].num
									+ '</td>'
							html += '<td>' + arr[i].orderDetails[j].detail_price
									+ '</td></tr>';
						}
						html += '</tbody></table><a href="javascript:void(0)" onclick="document.getElementById(\'light\').style.display=\'none\';document.getElementById(\'fade\').style.display=\'none\'">点这里关闭本窗口</a></div>';
						html += '<div id="fade" class="black_overlay"></div></td>';
						html += '<td><a href="">删除</a></td>';
						if(arr[i].state==false)html+='<td><a href="<%=request.getContextPath()%>/FinishOrder?finish='+arr[i].order_id+'">发货</a></td></tr>';
						else html+='<td></td></tr>';
					}
					html += '</table></div></div>';

					document.getElementById("c").innerHTML = html;
				}
			}
		}
		xmlhttp.open("get", "../ShowAllOrders");
		xmlhttp.send(null);
	}
</script>

<body>
	<div
		class="sidebar sidebar-hide-to-small sidebar-shrink sidebar-gestures">
		<div class="nano">
			<div class="nano-content">
				<ul>
					<div class="logo">
						<a href="index.jsp"><span>管理员后台系统</span></a>
					</div>
					<li class="label">Main</li>
					<li><a class="sidebar-sub-toggle"><i class="ti-home"></i>用户管理
							<span class="sidebar-collapse-icon ti-angle-down"></span></a>
						<ul>
							<li><a href="allUser.jsp">查看所有用户</a></li>
							<li><a href="modifyUser.jsp">用户信息修改</a></li>
						</ul></li>
					<li><a class="sidebar-sub-toggle"><i
							class="ti-bar-chart-alt"></i>商品管理 <span
							class="sidebar-collapse-icon ti-angle-down"></span></a>
						<ul>
							<li><a href="modifyCommidity.jsp">商品信息修改</a></li>
						</ul></li>
					<li><a href="orderManager.jsp"><i class="ti-calendar"></i>
							订单管理 </a></li>

				</ul>
			</div>
		</div>
	</div>
	<div class="header">
		<div class="container-fluid">
			<div class="row">
				<div class="col-lg-12">
					<div class="dropdown dib">
						<div class="header-icon" data-toggle="dropdown">
							<span class="user-avatar"><%=request.getSession().getAttribute("userid") %> <i
								class="ti-angle-down f-s-10"></i>
							</span>
							<div
								class="drop-down dropdown-profile dropdown-menu dropdown-menu-right">
								<div class="dropdown-content-body">
									<ul>
										<li><a href="#"> <i class="ti-settings"></i> <span>Setting</span>
										</a></li>

										<li>
                                                <a onclick='location="<%=request.getContextPath() %>/exit"'>
                                                    <i class="ti-power-off"></i>
                                                    <span>Logout</span>
                                                </a>
                                            </li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>

	<div class="content-wrap">
		<div class="main">
			<div class="container-fluid">
				<div class="row">
					<div class="col-lg-8 p-r-0 title-margin-right">
						<div class="page-header">
							<div class="page-title">
								<h1>
									Hello, <span>There are all orders.</span>
								</h1>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div>
				<div class="card">
					<div class="card-title pr">
						<h4>All Exam Result</h4>
					</div>
					<div id='c'></div>
				</div>
			</div>
		</div>
	</div>
	<script src="assets/js/lib/jquery.min.js"></script>
	<script src="assets/js/lib/jquery.nanoscroller.min.js"></script>
	<script src="assets/js/lib/menubar/sidebar.js"></script>
	<script src="assets/js/lib/preloader/pace.min.js"></script>
	<script src="assets/js/lib/bootstrap.min.js"></script>
	<script src="assets/js/lib/circle-progress/circle-progress.min.js"></script>
	<script src="assets/js/lib/circle-progress/circle-progress-init.js"></script>
</body>

</html>